package com.cqgc.dao;

import com.cqgc.domain.Colony;

import com.cqgc.domain.Harvest;
import com.cqgc.domain.PageHelper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface ColonyDao {



    @Update("update colony set state = 0 where cid=#{cid}")
    int delColony(Colony colony);

    @Update("update colony set state = 1 where cid=#{cid} ")
    int stopUse(Colony colony);

    int update(Colony colony);

    @Insert("insert into colony values(null,#{cname},#{ccount},#{cwarm},#{ctag},2,null)")
    int addColony(Colony colony);

    @Select("select * from colony where fid=#{fid} and state!=0")
    List<Colony> findByFather(int fid);

    @Select("select * from colony where state!=0")
    List<Colony> findAll();

    //    找正常状态的牧场
    @Select("select * from colony where state =2;")
    List<Colony> findGood(int s);
    //    找bu正常状态的牧场
    @Select("select * from colony where state =1;")
    List<Colony> findStop(int s);

    @Select("select * from colony where state = 1 limit #{currentPage},#{pageSize}")
    List<Colony> findpage(PageHelper pagePelper);

    List<Colony> searchC(String colony);


}
